package com.maikang.exammall.service;

import com.maikang.exammall.entity.Examinee;
import com.maikang.exammall.repository.ExamineeRepository;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Log4j2
@Service
public class ExamineeService extends BaseService<Examinee, Long, ExamineeRepository> {

    @Transactional(rollbackFor = Exception.class)
    public void deleteByIdAndUserId(Long id, Long userId) {
        repository.deleteByIdAndUserId(id, userId);
    }

    public Iterable<Examinee> findAllByUserId(Long userId) {
        return repository.findAllByUserId(userId);
    }
}
